﻿using BCCommon;
using BCDto.TMS.RedPacket.RedPacket;
using BCDto.TMS.RedPacket.RedPacket.RedPacketRequest;
using BCDto.TMS.RedPacket.RedPacketReceive;
using BCService.TMS.RedPacket.RedPacket;
using BCService.TMS.RedPacket.RedPacketReceive;
using BCTMSRESTful.Configs;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;

namespace BCTMSRESTful.Controllers.ClientApp.RedPacket
{
    /// <summary>
    /// 红包
    /// </summary>
    [Route("api/v1/ClientApp/[controller]")]
    [ApiExplorerSettings(GroupName = "ClientApp")]
    public class RedPacketController : ClientAppBaseController
    {
        private readonly IRedPacketReceiveService redPacketReceiveService;

        public RedPacketController(IRedPacketReceiveService redPacketReceiveService)
        {
            this.redPacketReceiveService = redPacketReceiveService;
        }

        /// <summary>
        /// 获取红包领取记录
        /// </summary>
        /// <returns></returns>
        [HttpGet("[action]")]
        [ProducesResponseType(typeof(IEnumerable<RedPacketReceiveDto>), 200)]
        public IActionResult ReceiveList()
        {
            if (this.UserInfo==null)
            {
                throw new ArgumentException("登录超时，请重新登录");
            }
            var result = this.redPacketReceiveService.GetList(null, null, UserInfo.UserId);
            return this.Ok(result);
        }
    }
}
